// components/navbar/index.js
const App = getApp();

Component({
  options: {
    addGlobalClass: true,
  },
  /**
   * 组件的属性列表
   */
  properties: {
    pageName:String,
    showNav:{
      type:Boolean,
      value:true
    },
    showHome: {
      type: Boolean,
      value: true
    },
    isShow: {
      type: Boolean,
      value: false
    },
    isTitle: {
      type: Boolean,
      value: false
    },
    showNav: {
      type: Boolean,
      value: false
    },
    // index: {
    //   type: String,
    //   value: 0
    // },
    // 自定义头部背景色 0为默认白色 1： 迅云蓝
    isBg: {
      type: String,
      value: 0

    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    navTop: App.globalData.navTop,
    navHeight: App.globalData.navHeight,
    windowHeight: App.globalData.windowHeight,
   
    index: 0,
  },
  lifetimes: {
    attached: function () {
      this.setData({
        navH: App.globalData.navHeight
      })
     }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    bindPickerChange: function (e) {
      console.log(e)
      console.log('picker发送选择改变，携带值为', e.detail.value)
      this.triggerEvent('clicks',e.detail.value);
      this.setData({
        index: e.detail.value
      })
    },
    //回退
    navBack: function () {
   
      wx.navigateBack({
        delta: 1
      })
    },
    //回主页
    toIndex: function () {
      wx.navigateTo({
        url: '/pages/admin/home/index/index'
      })
    },
    titlehandel(){
      this.triggerEvent('click');
    },
  }
})
